﻿using System;
using Plugins.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Configuration;
using System.Windows.Input;

namespace Plugins
{
    public interface ICore
    {
        /// <summary>
        /// Plugin focus changed
        /// </summary>
        event EventHandler<FocusChangedArgs> FocusChanged;

        /// <summary>
        /// Button clicked
        /// </summary>
        event EventHandler<ButtonClickedArgs> ButtonClicked;

        /// <summary>
        /// File choosed event
        /// </summary>
        event EventHandler<FileChoosedArgs> FileChoosed;

        /// <summary>
        /// Gets RichTextBox used for expression writing
        /// </summary>
        RichTextBox ExpressionBox
        {
            get;
        }

        /// <summary>
        /// Gets or sets expression string writen in ExpressionBox
        /// </summary>
        string Expression
        {
            get;
            set;
        }

        /// <summary>
        /// Gets TreeListView used for showing XML tree
        /// </summary>
        TreeListView View
        {
            get;
        }

        /// <summary>
        /// Gets evaluate button
        /// </summary>
        string EvaluateButtonContent
        {
            get;
            set;
        }

        MenuItem PluginMenu
        {
            get;
        }

        Dictionary<string, string> Settings
        {
            get;
        }    
    }

    /// <summary>
    /// EventArgs for ICore.FocusChanged event
    /// </summary>
    public class FocusChangedArgs : EventArgs
    {
        private IPlugin _activePlugin;

        public FocusChangedArgs() : base() 
        { 
        }

        public FocusChangedArgs(IPlugin activePlugin)
        {
            _activePlugin = activePlugin;
        }

        /// <summary>
        /// Gets or sets active plugin.
        /// </summary>
        public IPlugin ActivePlugin
        {
            get { return _activePlugin; }
            set { _activePlugin = value; }
        }
    }

    public class ButtonClickedArgs : EventArgs
    {
        public enum ButtonType
        {
            BackButton,
            NextButton,
            EvaluateButton
        }

        private ButtonType _buttonType;

        public ButtonClickedArgs(ButtonType buttonType)
        {
            _buttonType = buttonType;
        }

        /// <summary>
        /// Gets or sets button type
        /// </summary>
        public ButtonType WindowButtonType
        {
            get { return _buttonType; }
            set { _buttonType = value; }
        }
    }

    public class FileChoosedArgs : EventArgs 
    {
        private string _filePath;

        public FileChoosedArgs(string filePath) 
        {
            _filePath = filePath;
        }

        public string FilePath 
        {
            get { return _filePath; }
            set { _filePath = value; }
        }
    }
}
